package com.example.test;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.TextView;
import android.view.View;

public class MainActivity extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		/*
		 * TextView tv = new TextView(this); tv.setText("Hello ! Android");
		 * setContentView(tv);
		 */
		Button btn = (Button) findViewById(R.id.mybutton);
		btn.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				TextView tv = (TextView) findViewById(R.id.mytext);
				tv.setText("This is text after click button");
				EditText ed = (EditText) findViewById(R.id.myeditText);
				ed.setText("Android Market is an online software store "
						+ "developed by Google for Android devices. "
						+ "An application program (\"app\") called \"Market\" "
						+ "is preinstalled on some Android devices and "
						+ "allows users to browse and download apps published "
						+ "by third-party developers, hosted on Android Market.");
			}
		});
		final CheckBox checkBox = (CheckBox) findViewById(R.id.mychecked);
		checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

			@Override
			public void onCheckedChanged(CompoundButton buttonView,
					boolean isChecked) {
				if (isChecked) {
					checkBox.setText("state : checked");
				} else {
					checkBox.setText("state : unchecked");
				}
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

}
